//
//  ZHAboutUsViewController.m
//  ZHPriorityTreatment
//
//  Created by 陈武琦 on 15/11/16.
//  Copyright © 2015年 aqi. All rights reserved.
//

#import "WCNWebViewController.h"

@interface WCNWebViewController ()<UIWebViewDelegate>
@property( nonatomic,strong)UIWebView *myWebView;
@end

@implementation WCNWebViewController

- (void)viewDidLoad {
    
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    self.myWebView = [ [UIWebView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, kScreenHeight - 64)];
    self.myWebView.dataDetectorTypes = UIDataDetectorTypeAll;//自动检测网页上的电话号码，单击可以拨打
    self.myWebView.scalesPageToFit = YES;//自动对页面进行缩放以适应屏幕
    self.myWebView.delegate = self;
    [self.view addSubview:self.myWebView];
    //NSURL *url = [NSURL URLWithString:self.url];
    NSURLRequest *request = [NSURLRequest requestWithURL:self.url];
    [self.myWebView loadRequest:request];
}

- (void)webViewDidFinishLoad:(UIWebView *)webView {

    [[NSUserDefaults standardUserDefaults] setInteger:0 forKey:@"WebKitCacheModelPreferenceKey"];
    [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"WebKitDiskImageCacheEnabled"];//自己添加的，原文没有提到。
    [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"WebKitOfflineWebApplicationCacheEnabled"];//自己添加的，原文没有提到。
    [[NSUserDefaults standardUserDefaults] synchronize];

}


//- (void)webViewDidFinishLoad:(UIWebView *)webView {
//    [[NSUserDefaults standardUserDefaults] setInteger:0 forKey:@"WebKitCacheModelPreferenceKey"];
//}

- (void)dealloc {

    NSLog(@"-------ZHAboutUsViewController-----------");
    [[NSURLCache sharedURLCache] removeAllCachedResponses];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
